package com.guiwu.dto;

import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.math.BigDecimal;
import java.time.LocalDate;

public class ItemDto {
    
    private Long id;
    
    @NotBlank(message = "物品名称不能为空")
    private String name;
    
    private String description;

    @NotNull(message = "物品分类不能为空")
    private Long categoryId;

    // 保留category字段用于兼容性（可选）
    private String category;

    @NotNull(message = "物品价格不能为空")
    @Positive(message = "物品价格必须大于0")
    private BigDecimal price;
    
    @NotNull(message = "入手时间不能为空")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate purchaseDate;
    
    // 构造函数
    public ItemDto() {}
    
    public ItemDto(Long id, String name, String description, String category, BigDecimal price, LocalDate purchaseDate) {
        this.id = id;
        this.name = name;
        this.description = description;
        this.category = category;
        this.price = price;
        this.purchaseDate = purchaseDate;
    }
    
    // Getter和Setter方法
    public Long getId() {
        return id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public String getDescription() {
        return description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    public String getCategory() {
        return category;
    }
    
    public void setCategory(String category) {
        this.category = category;
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    public BigDecimal getPrice() {
        return price;
    }
    
    public void setPrice(BigDecimal price) {
        this.price = price;
    }
    
    public LocalDate getPurchaseDate() {
        return purchaseDate;
    }
    
    public void setPurchaseDate(LocalDate purchaseDate) {
        this.purchaseDate = purchaseDate;
    }
} 